<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>比例尺的使用 - 序数比例尺</title>
	<script src="./d3/d3.v3.min.js" charset="utf-8"></script>
	<style>
		
	</style>
</head>
<body>
<p>看控制台</p>
</body>
<script type="text/javascript">



var index = [0, 1, 2, 3, 4];
var color = ["red", "blue", "green", "yellow", "black"];
var ordinal = d3.scale.ordinal()
        .domain(index)
        .range(color);


console.log(ordinal(0)); //返回 red
console.log(ordinal(2)); //返回 green
console.log(ordinal(4)); //返回 black




</script>
</html>
